<?php
class IndexBusiness extends CWidget
{
	public $n=1;
	public $product_sort='0201';

	public function run()
	{
		$criteria=new CDbCriteria;
		$page='';
		if($this->n==1){//首页 推荐品牌
			$criteria->addCondition('recommend2>0');
			$criteria->addCondition('state=0');
			$criteria->order='recommend2 desc,update_time desc';
			$criteria->limit=10;
			$page='index1';
		}
		if($this->n==2){//首页  分类
			$criteria->addCondition('FIND_IN_SET("'.$this->product_sort.'",product_sort)>0');
			$criteria->addCondition('state=0 and recommend3>0');
			$criteria->order='recommend3 desc,update_time desc';
			$criteria->limit=14;
			$page='index2';
		}
		$models=Business::model()->findAll($criteria);
		$this->render($page,array('models'=>$models));
	}

	
}